﻿using _01_Tower4._0.Tool;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _01_Tower4._0.GameFrame.System
{
    internal class EventSystem : TSingleton<EventSystem>
    {
        Dictionary<string, Action> actions = new Dictionary<string, Action>();
        // 事件系统
        // 事件的发布者 -> menu
        // 事件的接收者

        public void AddEvent(string name, Action action)
        {
            actions[name] = action;
        }

        public void RemoveEvent(string name)
        {
            actions.Remove(name);
        }

        public void InvokeEvent(string name)
        {
            actions[name].Invoke();
        }
    }
}
